package top.yokey.shopnc.model;

import top.yokey.base.base.BaseHttpClient;
import top.yokey.base.base.BaseHttpListener;

@SuppressWarnings("ALL")
public class MemberAddressModel {

    private final String ACT = "member_address";
    private static volatile MemberAddressModel instance;

    public static MemberAddressModel get() {
        if (instance == null) {
            synchronized (MemberAddressModel.class) {
                if (instance == null) {
                    instance = new MemberAddressModel();
                }
            }
        }
        return instance;
    }

    public void addressList(BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "address_list")
                .post(baseHttpListener);

    }

    public void addressDel(String addressId, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "address_del")
                .add("address_id", addressId)
                .post(baseHttpListener);

    }

    public void addressAdd(String name, String phone, String cityId, String areaId, String address, String areaInfo, String isDefault, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "address_add")
                .add("true_name", name)
                .add("mob_phone", phone)
                .add("city_id", cityId)
                .add("area_id", areaId)
                .add("address", address)
                .add("area_info", areaInfo)
                .add("is_default", isDefault)
                .post(baseHttpListener);

    }

    public void addressEdit(String addressId, String name, String phone, String cityId, String areaId, String address, String areaInfo, String isDefault, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "address_edit")
                .add("address_id", addressId)
                .add("true_name", name)
                .add("mob_phone", phone)
                .add("city_id", cityId)
                .add("area_id", areaId)
                .add("address", address)
                .add("area_info", areaInfo)
                .add("is_default", isDefault)
                .post(baseHttpListener);

    }

}
